#include "camerainfowidget.h"
#include <QHBoxLayout>
#include <QLabel>

CameraInfoWidget::CameraInfoWidget(QWidget *parent)
    : QWidget{parent}
{
    InitContent();

    m_pFaceLabel->setStyleSheet("QLabel { color : #78d9e0; }");
    m_pPositionLabel->setStyleSheet("QLabel { color : #78d9e0; }");
    m_pCountLabel->setStyleSheet("QLabel { color : #78d9e0; }");
    QFont font = m_pFaceLabel->font(); // 获取当前字体
    font.setPointSize(12); // 设置字体大小为14
    m_pFaceLabel->setFont(font); // 应用新的字体设置
    m_pPositionLabel->setFont(font); // 应用新的字体设置
    m_pCountLabel->setFont(font); // 应用新的字体设置
}

void CameraInfoWidget::SetFace(QString strFace){
    m_strFace = strFace;
    m_pFaceLabel->setText(QString("%1").arg(m_strFace));
}
void CameraInfoWidget::SetPosition(int nPosition){
    m_nPosition = nPosition;
    m_pPositionLabel->setText(QString("座椅位置:%1").arg(m_nPosition));
}

void CameraInfoWidget::SetDefectCount(int nDefectCount){
    m_nDefectCount = nDefectCount;
    m_pCountLabel->setText(QString("缺陷数量:%1").arg(m_nDefectCount));
}

void CameraInfoWidget::InitContent(){
    m_pFaceLabel        = new QLabel();
    m_pPositionLabel    = new QLabel();
    m_pCountLabel       = new QLabel();

    QHBoxLayout *pLayout = new QHBoxLayout();
    pLayout->addWidget(m_pFaceLabel);
    pLayout->addWidget(m_pPositionLabel);
    pLayout->addWidget(m_pCountLabel);
    this->setLayout(pLayout);
}
